let data = {
    pages: [
        {
            windowId: 1,
            title: "百度",
            url:"https://www.baidu.com"
        },
        {
            windowId: 2,
            title: "亿企代账",
            url:"https://www.17dz.com"
        },
        {
            windowId: 3,
            title: "搜狐",
            url:"https://www.sohu.com"
        },
        {
            windowId: 4,
            title: "税友集团",
            url:"https://www.servyou.com.cn"
        }
    ],
    activeWindowId:1
}

let gId = data.pages.length
export default {
    "GET /api/getPages": (req, res) => {
        
        setTimeout(() => {
            res.json({
                code: 0,
                data:data
            })
        }, 30);

    },
    "GET /api/newPage": (req, res) => {
        gId = gId +1;
        data.pages.push({
            windowId : gId,
            title:"新增",
            url:''
        });
        setTimeout(() => {
            res.json({
                code: 0,
                windowId: gId
            })
        }, 10);

    },

    "POST /api/changePage": (req, res) => {
        data.activeWindowId = req.body.windowId;

        setTimeout(() => {
            res.json({
                code: 0,
                windowId: data.activeWindowId
            })
        }, 10);

    },
    
}